# Build recipe for qire.
#
# Copyright (c) 2020 Kevin "The Nuclear" Bloom, <nuclearkev@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Dependencies:
# Build:
# - lua
# - fennel
# - luastatic
# - make
# Runtime:
# - qi
# - wget
# - sha256sum

program=qire
version=0.0.3
release=1

# Set 'outdir' for a nice and well-organized output directory
pkghashtag=tools

tarname=${program}-${version}.tar.gz

# Remote source(s)
#fetch=https://notabug.org/nuclearkev/qire/archive/v0.0.3/qire-0.0.3.tar.lz

description="
Qi Remote Extension

Qire is the remote package manager for Dragora 3 systems.
"

homepage=https://notabug.org/nuclearkev/qire/
license="GPLv3"

# Source documentation
docs="README.md"
docsdir="${docdir}/${program}-${version}"

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    # Set sane permissions
    chmod -R u+w,go-w,a+rX-s .

    make
    make PREFIX=/usr DESTDIR="$destdir" install

#    lzip -9 "${destdir}/${mandir}/man1/st.1"

    # Copy documentation
    mkdir -p "${destdir}${docsdir}"
    cp -p $docs "${destdir}${docsdir}"/
}
